let baseUrl = 'https://api.vvhan.com'
// let baseUrl = 'https://mockapi.eolink.com'
export const $http = function(url, method, data = {}) {
	return new Promise((resolve, reject) => {
		uni.request({
			url: baseUrl + url,
			method,
			header: {
				// 'Content-Type': 'application/x-www-form-urlencoded'
			},
			data,
			dataType: 'json',
			success: res => {
				// console.log('数据');
				// console.log(res);
				resolve(res.data)
			},
			fail: (err) => {
				reject(err)
			},
			complete: () => {}
		});
	})
}
export const $get = function(url, data = {}) {
	return $http(url, 'GET', data)
}
export const $post = function(url, data = {}) {
	return $http(url, 'POST', data)
}